{% set pypi_name = 'sushy' %}
{% set upstream_version = upstream_version('3.5.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python library to communicate with Redfish based systems
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-dateutil') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('reno') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
Sushy is a Python library to communicate with `Redfish` based systems.

%package -n python3-sushy
Summary:        Python library to communicate with Redfish based systems
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('python-dateutil') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('stevedore') }}

%description -n python3-sushy
Sushy is a Python library to communicate with `Redfish` based systems.

%package -n {{ py2name() }}-doc
Summary:        Documentation for OpenStack sushy
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n {{ py2name() }}-doc
Sushy is a Python library to communicate with `Redfish` based systems.
This package contains the documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n python3-sushy
%license LICENSE
%doc AUTHORS ChangeLog README.rst
%{python3_sitelib}/sushy*
%{python3_sitelib}/*.egg-info

%files -n {{ py2name() }}-doc
%doc doc/build/html
%license LICENSE

%changelog
